home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / PLASMA10.ZIP / SRC / PLASMA.QC next >
Encoding:
Text File  |  1996-12-05  |  3.8 KB  |  188 lines

  1. /*
  2. =======================================================================
  3.  
  4. Plasma Gun version 1.0
  5. by Jonathan E. Wright
  6. <nelno@interpath.com>
  7. http://www.trailerpark.com/phase1/nelno/
  8.  
  9. =======================================================================
  10. */
  11.  
  12. /*
  13. ==================
  14. macros
  15. ==================
  16. */
  17.  
  18. $frame nailatt1 nailatt2
  19.  
  20. /*
  21. ==================
  22. prototypes
  23. ==================
  24. */
  25.  
  26. void () SuperDamageSound;
  27. void (float damage) spawn_touchblood;
  28. void () player_run;
  29.  
  30. /*
  31. ==================
  32. constants
  33. ==================
  34. */
  35.  
  36. float   IT_PLASMA = 16777216;
  37.  
  38. /*
  39. ==================
  40. plasma_precache
  41. ==================
  42. */
  43.  
  44. void () plasma_precache =
  45. {
  46.   precache_sound ("plasma/plasma.wav");
  47.   precache_sound ("plasma/plasexpl.wav");
  48.   precache_model ("progs/s_plasma.spr");
  49. };
  50.  
  51. void()    plasma_impact1  =    [1,        plasma_impact2] {};
  52. void()    plasma_impact2    =    [2,        plasma_impact3] {};
  53. void()    plasma_impact3    =    [3,        plasma_impact4] {};
  54. void()    plasma_impact4    =    [4,        plasma_impact5] {};
  55. void()    plasma_impact5    =    [1,        plasma_impact6] {};
  56. void()    plasma_impact6    =    [5,        SUB_Remove ] {};
  57.  
  58.  
  59. /*
  60. ==================
  61. plasma_touch
  62. ==================
  63. */
  64.  
  65. void () plasma_touch =
  66. {
  67. local float rand;
  68. // hit something that bleeds
  69.   if (other.takedamage)
  70.   {
  71.     // direct hit on an entity
  72.     spawn_touchblood (2);
  73.     // in Doom a single plasma bolt does 2 points of damage
  74.     // but in Quake, it does 12 to achieve the same effect
  75.     T_Damage (other, self, self.owner, 12);
  76.   }
  77.  
  78.   sound (self, CHAN_WEAPON, "plasma/plasexpl.wav", 1, ATTN_NORM);
  79.  
  80.   self.nextthink = time + 0.1;
  81.   self.think = plasma_impact1;
  82.   self.touch = SUB_Null;
  83.   self.velocity = '0 0 0';
  84. };
  85.  
  86.  
  87. /*
  88. ==================
  89. plasma_firebolt
  90. ==================
  91. */
  92.  
  93. void () plasma_firebolt =
  94. {
  95.   local vector    dir;
  96.   local entity    old;
  97.  
  98.   makevectors (self.v_angle);
  99.  
  100.   if (self.ammo_cells < 1 && self.weapon == IT_PLASMA)
  101.   {
  102.     self.weapon = W_BestWeapon ();
  103.     W_SetCurrentAmmo ();
  104.     return;
  105.   }
  106.  
  107.   self.attack_finished = time + 0.1;
  108.   self.currentammo = self.ammo_cells = self.ammo_cells - 1;
  109.   dir = aim (self, 1000);
  110.  
  111. //  dir = normalize ((self.origin + (v_forward * 1000)) - self.origin);
  112.  
  113.   // launch the energy ball
  114.  
  115.   sound (self, CHAN_WEAPON, "plasma/plasma.wav", 1, ATTN_NORM);
  116.  
  117.   newmis = spawn ();
  118.   newmis.owner = self;
  119.   newmis.movetype = MOVETYPE_FLYMISSILE;
  120.   newmis.solid = SOLID_BBOX;
  121.  
  122.   newmis.touch = plasma_touch;
  123.   newmis.classname = "plasma_bolt";
  124.   newmis.think = SUB_Remove;
  125.   newmis.nextthink = time + 3;
  126.   setmodel (newmis, "progs/s_plasma.spr");
  127.   setsize (newmis, '-0 -0 -0', '0 0 0');
  128.   setorigin (newmis, self.origin + '0 0 0');
  129.  
  130.   newmis.frame = 0;
  131.  
  132. //  newmis.velocity = dir * 750;
  133. // add players velocity to shots
  134.   newmis.velocity = (self.velocity * 0.5) + (dir * 750);
  135.   newmis.angles = vectoangles (dir);
  136.  
  137.   newmis.v_angle = self.v_angle;
  138.  
  139.   self.punchangle_x = -2;
  140.   self.attack_finished = time + 0.1;
  141. };
  142.  
  143. /*
  144. ==================
  145. plasma_attack
  146. ==================
  147. */
  148.  
  149. void () plasma_attack1   =[$nailatt1, plasma_attack2  ]
  150. {
  151.   self.effects = self.effects | EF_MUZZLEFLASH;
  152.  
  153.   if (!self.button0)
  154.   {
  155.     player_run ();
  156.     return;
  157.   }
  158.  
  159.   self.weaponframe = self.weaponframe + 1;
  160.  
  161.   if (self.weaponframe == 9) self.weaponframe = 1;
  162.   SuperDamageSound();
  163.  
  164.   plasma_firebolt ();
  165.   self.attack_finished = time + 0.1;
  166. };
  167.  
  168. void() plasma_attack2   =[$nailatt2, plasma_attack1  ]
  169. {
  170.   self.effects = self.effects | EF_MUZZLEFLASH;
  171.  
  172.   if (!self.button0)
  173.   {
  174.     player_run ();
  175.     return;
  176.   }
  177.  
  178.   self.weaponframe = self.weaponframe + 1;
  179.  
  180.   if (self.weaponframe == 9) self.weaponframe = 1;
  181.   SuperDamageSound();
  182.  
  183.   plasma_firebolt ();
  184.   self.attack_finished = time + 0.1;
  185. };
  186.  
  187. //============================================================================
  188.